home *** CD-ROM | disk | FTP | other *** search
/ EOS Science Plan & Executive Summary / EOS Science Plan and Executive Summary.iso / pc / Acrobat Reader Installers / linux_tar_files / INSTALL < prev    next >
Encoding:
Text File  |  2002-08-22  |  13.3 KB  |  678 lines

  1. #!/bin/sh
  2. #
  3. # Install Script for UNIX Acrobat Exchange and Reader v. 5.0.6
  4. #
  5. # Copyright (c)1995-2002 Adobe Systems Incorporated
  6. # All Rights Reserved
  7. #
  8. ##########################################################################
  9.  
  10. echoawk ()
  11. {
  12.   echo $* | awk '{ printf "%s", $0 }'
  13. }
  14.  
  15. echon ()
  16. {
  17.   echo -n "$*"
  18. }
  19.  
  20. echoc ()
  21. {
  22.   echo "${*}\c"
  23. }
  24.  
  25. ##########################################################################
  26.  
  27. yesno()
  28. {
  29.   msg="$1"
  30.   def="$2"
  31.   while true ; do
  32.     echo " "
  33.     $echonl "$msg"
  34.     read answer
  35.     if [ "$answer" ] ; then
  36.       case "$answer" in
  37.         y|Y|yes|YES)
  38.           return 0
  39.           ;;
  40.         n|N|no|NO)
  41.           return 1
  42.           ;;
  43.         *)
  44.           echo " "
  45.           echo "ERROR: Invalid response, expected \"yes\" or \"no\"."
  46.           continue
  47.           ;;
  48.       esac
  49.     else
  50.       return $def
  51.     fi
  52.   done
  53. }
  54.  
  55. TypeCheck() 
  56. {
  57.   h=`type $1 2> /dev/null`
  58.   case " $h " in
  59.   *' '/*/$1' '*)
  60.     return 0
  61.     ;;
  62.   *)
  63.     return 1
  64.     ;;
  65.   esac
  66. }
  67.  
  68.  
  69. OutputLicense ()
  70. {
  71.   if [ -z "$1" ] ; then
  72.     return
  73.   fi
  74.  
  75.   if [ ! -f "$1" ] ; then
  76.     echo " "
  77.     echo "ERROR: Cannot find license file ... aborting"
  78.     echo " "
  79.     exit 1
  80.   else
  81.     LicenseFile="$1"
  82.   fi
  83.  
  84.  TypeCheck $PAGER 
  85.   if  [ $? -ne 0 ] || [ -z "$PAGER" ] ; then
  86.     command=cat
  87.     TypeCheck pg
  88.     if [ $? -eq 0 ] ; then 
  89.       command=pg 
  90.     fi
  91.     TypeCheck more
  92.     if [ $? -eq 0 ] ; then 
  93.       command=more 
  94.     fi
  95.   else
  96.       command="$PAGER"
  97.   fi
  98.  
  99.  
  100.   echo " "
  101.   $command "$LicenseFile"
  102.  
  103.   answer=
  104.   while [ -z "$answer" ] ; do
  105.     echo " "
  106.     echo " "
  107.     echo "To accept the terms and conditions of this agreement enter \"accept\"."
  108.     echo "To decline the terms and conditions of this agreement enter \"decline\"."
  109.     echo " "
  110.     $echonl "Please type \"accept\" to accept the terms and conditions license agreement; Type \"decline\" to exit. "
  111.     read answer
  112.     ucanswer=`echo "${answer}" | tr '[a-z]' '[A-Z]'`
  113.     case "$ucanswer" in
  114.     ACCEPT)
  115.       ;;
  116.     DECLINE)
  117.       echo " "
  118.       echo "License not accepted ... aborting installation"
  119.       echo " "
  120.       exit 1
  121.       ;;
  122.     *)
  123.       echo " "
  124.       echo "ERROR: Invalid response, expected \"accept\" or \"decline\" ... try again"
  125.       answer=
  126.       ;;
  127.     esac
  128.   done
  129. }
  130.  
  131. PrintRequiredFree()
  132. {
  133.   total=0
  134.   for i in $* ; do
  135.     if [ "$i" -a -f "$i" ] ; then
  136.         if [ `uname -s` = "Linux" ] ; then
  137.           size=`ls -lLn "$i" | ( read perm links owner group size date ; echo $size )`
  138.         else
  139.           size=`ls -lLon "$i" | ( read perm links owner size date ; echo $size )`
  140.         fi
  141.       if [ "$size" ] ; then
  142.         total=`expr $total + $size`
  143.       fi
  144.     fi
  145.   done
  146.  
  147.   megs=`expr $total / 1048576 + 1`
  148.  
  149.   echo " "
  150.   echo "This installation requires ${megs}MB of free disk space."
  151. }
  152.  
  153. FilterPathName ()
  154. {
  155.   newpathname="$1"
  156.   case "$newpathname" in
  157.     ~*)
  158.       if [ -f /bin/csh -a -x /bin/csh ] ; then
  159.         newpathname=`/bin/csh -c "echo $newpathname"`
  160.       fi
  161.       ;;
  162.     ../*|./*)
  163.       newpathname=`pwd`/"${newpathname}"
  164.       ;;
  165.     *)
  166.       ;;
  167.   esac
  168.   eval newpathname=\"${newpathname}\"
  169.   echo "${newpathname}"
  170. }
  171.  
  172. ExtractFiles ()
  173. {
  174.   ( cd "$1" ; tar xf "$2" )
  175. }
  176.  
  177. InstallFiles ()
  178. {
  179.   msg="$1"
  180.   install="$2"
  181.   shift
  182.   shift
  183.  
  184.   echo " "
  185.  
  186.   for i in "$@" ; do
  187.     if [ "$i" ] ; then
  188.       if [ "$msg" ] ; then
  189.         $echonl "$msg"
  190.         msg=""
  191.       fi
  192.       ExtractFiles "$install" "$i"
  193.     fi
  194.   done
  195.  
  196.   if [ -z "$msg" ] ; then
  197.     echo "Done"
  198.   fi
  199. }
  200.  
  201. InstallBin()
  202. {
  203.   topdir="$1"
  204.   product="$2"
  205.  
  206.   for i in "$topdir"/bin/*.sh ; do
  207.     if [ -f "$i" ] ; then
  208.       filename="$topdir"/bin/`basename "$i" .sh`
  209.  
  210.       case "$product" in
  211.         Reader)
  212.           replacement="$topdir"/"$product"
  213.           ;;
  214.         *)
  215.           echo "ERROR installing $filename, invalid product name"
  216.           ;;
  217.       esac
  218.  
  219.       ed -s "$i" <<__EOF__
  220.         1,\$s@REPLACE_ME@$replacement@
  221.         w
  222.         q
  223. __EOF__
  224.       if [ $? != 0 ] ; then
  225.         echo "ERROR installing $filename"
  226.         continue
  227.       fi
  228.  
  229.       chmod +x "$i"
  230.       if [ $? != 0 ] ; then
  231.         echo "ERROR installing $filename"
  232.         continue
  233.       fi
  234.  
  235.       rm -f "$filename"
  236.       mv "$i" "$filename"
  237.       if [ $? != 0 ] ; then
  238.         echo "ERROR installing $filename"
  239.         continue
  240.       fi
  241.  
  242.     fi
  243.   done
  244. }
  245.  
  246. GetInstallDirectory ()
  247. {
  248.   if [ -z "$1" ] ; then
  249.     product=Acrobat
  250.   else
  251.     product="$1"
  252.   fi
  253.  
  254.   var=$2
  255.  
  256.   case "$product" in
  257.     Reader) productName="Acrobat Reader" ;;
  258.      *) productName="Acrobat" ;;
  259.   esac
  260.  
  261.   defdir="/usr/local/Acrobat5"
  262.   case "$OSname" in
  263.     SunOS)
  264.       case "$OSrelease" in
  265.         4.1.3*|4.1.4*|4.1C) defdir="/usr/Acrobat5" ;;
  266.         5.*) defdir="/opt/Acrobat5" ;;
  267.       esac
  268.       ;;
  269.     HP-UX)
  270.       case "$OSrelease" in
  271.         *.09.*) defdir="/usr/Acrobat5" ;;
  272.         *.10.*) defdir="/opt/Acrobat5" ;;
  273.         *) defdir="/opt/Acrobat5" ;;
  274.       esac
  275.       ;;
  276.     AIX)
  277.       defdir="/usr/lpp/Acrobat5"
  278.       ;;
  279.   esac
  280.  
  281.   while [ -z "$InstallDir" ] ; do
  282.  
  283.     InstallDir="$defdir"
  284.  
  285.     echo " "
  286.     $echonl "Enter installation directory for Acrobat ${Version} [${InstallDir}] "
  287.     read answer
  288.     case "$answer" in
  289.       "")
  290.         ;;
  291.       *)
  292.         InstallDir="$answer"
  293.         ;;
  294.     esac
  295.  
  296.     InstallDir=`FilterPathName "$InstallDir"`
  297.  
  298.     if [ ! -d "$InstallDir" ] ; then
  299.       echo " "
  300.       echo "Directory \"$InstallDir\" does not exist."
  301.       $echonl "Do you want to create it now? [y] "
  302.       read answer
  303.  
  304.       if [ "$answer" ] ; then
  305.           case "$answer" in
  306.              y|Y)
  307.                mkdir -p "$InstallDir"/"$product"
  308.              ;;
  309.              n|N)
  310.                echo "Exit installation...\n"
  311.                exit 0
  312.              ;;
  313.           esac
  314.       else
  315.          mkdir -p "$InstallDir"/"$product"
  316.       fi
  317.  
  318.       if [ ! -d "$InstallDir" ] ; then
  319.         echo " "
  320.         echo "ERROR: Cannot make directory \"$InstallDir\"."
  321.         InstallDir=""
  322.         continue;
  323.       fi
  324.     fi
  325.  
  326.     if ( echo foo > "$InstallDir"/AcroWriteTest ) 2> /dev/null ; then
  327.       rm -f "$InstallDir"/AcroWriteTest
  328.       break
  329.     else
  330.       echo " "
  331.       echo "ERROR: Cannot write to directory \"$InstallDir\"."
  332.       InstallDir=""
  333.       continue
  334.     fi
  335.   done
  336.  
  337.   eval $var=\"$InstallDir\"
  338. }
  339.  
  340. InstallReader()
  341. {
  342.   ReadConfig="$1"
  343.   ReadPlatformTar="$2"
  344.   SearchPlatformTar="$3"
  345.   CustomPlatformTar="$4"
  346.  
  347.   OutputLicense "$ReadLicense"
  348.   ReadLicense=""
  349.  
  350.   PrintRequiredFree "$ReadTar" "$SearchTar" "$CustomTar" \
  351.     "$ReadPlatformTar" "$SearchPlatformTar" "$CustomPlatformTar"
  352.  
  353.   if [ -z "$ReadInstallDir" ] ; then
  354.     GetInstallDirectory Reader ReadInstallDir
  355.   fi
  356.  
  357.   InstallFiles "Installing platform independent files ... " \
  358.     "$ReadInstallDir" "$ReadTar" "$SearchTar" "$CustomTar"
  359.   InstallFiles "Installing platform dependent files ... " \
  360.     "$ReadInstallDir" \
  361.     "$ReadPlatformTar" "$SearchPlatformTar" "$CustomPlatformTar"
  362.   InstallBin "$ReadInstallDir" Reader
  363.  
  364.   ReadTar=""
  365.   SearchTar=""
  366.   CustomTar=""
  367. }
  368.  
  369. ##############################################################
  370.  
  371. #
  372. # Initialization:
  373. #
  374.  
  375. umask 022
  376.  
  377. ScriptName=`basename $0`
  378. CurrentDirectory=`pwd`
  379. ScriptDirectory=`dirname $0`
  380. AcroSerNum=""
  381. AcroCompName=""
  382. case "${ScriptDirectory}" in
  383.   /*) ;;
  384.   .) ScriptDirectory="$CurrentDirectory" ;;
  385.   *) ScriptDirectory="$CurrentDirectory"/"$ScriptDirectory" ;;
  386. esac
  387.  
  388.  TypeCheck uname
  389.   if [ $? -eq 0 ] ; then
  390.     OSname=`uname -s`
  391.     if [ "$OSname" = "AIX" ] ; then
  392.       OSrelease=`uname -a | ( read name host minor major foo ; echo $major.$minor )`
  393.     else
  394.       OSrelease=`uname -r`
  395.     fi
  396.   else
  397.     OSname=unknown
  398.     OSrelease=unknown
  399.   fi
  400.  
  401.  
  402.  
  403. if [ `echo "x\c"` = "x" ] ; then
  404.   echonl=echoc
  405. else
  406.   echonl=echon
  407. fi
  408.  
  409. Version=5.0.5
  410.  
  411. #
  412. # Get the filenames:
  413. #
  414.  
  415. for i in ${ScriptDirectory}/* ${ScriptDirectory}/../COMMON/* ${ScriptDirectory}/../common/*; do
  416.   if [ -f "$i" ] ; then
  417.     case $i in
  418.       */licread.txt*|*/LICREAD.TXT*)
  419.         ReadLicense="$i"
  420.         ;;
  421.       */common.tar*|*/COMMON.TAR*)
  422.         ReadTar="$i"
  423.         ;;
  424.       */search.tar*|*/SEARCH.TAR*)
  425.         SearchTar="$i"
  426.         ;;
  427.       */custom.tar*|*/CUSTOM.TAR*)
  428.         CustomTar="$i"
  429.         ;;
  430.       */solrdr.tar*|*/SOLRDR.TAR*)
  431.         ReadSparcSolarisTar="$i"
  432.         ;;
  433.       */hpuxrdr.tar*|*/HPUXRDR.TAR*)
  434.         ReadHppaHpuxTar="$i"
  435.         ;;
  436.       */aixrdr.tar*|*/AIXRDR.TAR*)
  437.         ReadRS6000AIXTar="$i"
  438.         ;;
  439.       */linuxrdr.tar*|*/LINUXRDR.TAR*)
  440.         ReadIntelLinuxTar="$i"
  441.         ;;
  442.       */ilinxc.tar*|*/ILINXC.TAR*)
  443.         CustomIntelLinuxTar="$i"
  444.         ;;
  445.     esac
  446.   fi
  447. done
  448.  
  449.  
  450. #
  451. # Validate the configurations:
  452. #
  453.  
  454. NumConfigs=0
  455.  
  456. if [ "$ReadTar" -a "$ReadLicense" ] ; then
  457.   if [ "$ReadSparcSolarisTar" ] ; then
  458.     NumConfigs=`expr $NumConfigs + 1`
  459.     ReadSparcSolarisNum=$NumConfigs
  460.   fi
  461.   if [ "$ReadHppaHpuxTar" ] ; then
  462.     NumConfigs=`expr $NumConfigs + 1`
  463.     ReadHppaHpuxNum=$NumConfigs
  464.   fi
  465.   if [ "$ReadRS6000AIXTar" ] ; then
  466.     NumConfigs=`expr $NumConfigs + 1`
  467.     ReadRS6000AIXNum=$NumConfigs
  468.   fi
  469.   if [ "$ReadIntelLinuxTar" ] ; then
  470.     NumConfigs=`expr $NumConfigs + 1`
  471.     ReadIntelLinuxNum=$NumConfigs
  472.   fi
  473. fi
  474. if [ "$NumConfigs" = "0" ] ; then
  475.   echo " "
  476.   echo "ERROR: No configurations found ... aborting"
  477.   echo " "
  478.   exit 1
  479. elif [ "$NumConfigs" = "1" ] ; then
  480.   SingleConfig=true
  481. fi
  482.  
  483. NumConfigs=`expr $NumConfigs + 1`
  484. ExitNum=$NumConfigs
  485.  
  486.  
  487. #
  488. # Check if there is a configuration supported by this OS.
  489. #
  490.  
  491. case "$OSname" in
  492.   SunOS)
  493.     case "$OSrelease" in
  494.       4.1.3*|4.1.4*|4.1C)
  495.         ReadDefaultNum="$ReadSparcSunNum"
  496.         DefaultName="SPARC/SunOS 4.1.3 and later"
  497.         ;;
  498.       5.1|5.1.*|5.2|5.2.*)
  499.         ;;
  500.       5.*)
  501.         MachArch=`uname -p`
  502.         case "$MachArch" in
  503.           sparc)
  504.             ReadDefaultNum="$ReadSparcSolarisNum"
  505.             DefaultName="SPARC/Solaris 2.x"
  506.             ;;
  507.           esac
  508.         ;;
  509.     esac
  510.     ;;
  511.   HP-UX)
  512.     case "$OSrelease" in
  513.       *.09.*|*.10.*|*.11.*)
  514.         ReadDefaultNum="$ReadHppaHpuxNum"
  515.         DefaultName="HP-UX"
  516.         ;;
  517.     esac
  518.     ;;
  519.   AIX)
  520.     case "$OSrelease" in
  521.       4.*|5.*)
  522.         ReadDefaultNum="$ReadRS6000AIXNum"
  523.         DefaultName="AIX"
  524.       ;;
  525.     esac
  526.     ;;
  527.   Linux)
  528.     ReadDefaultNum="$ReadIntelLinuxNum"
  529.     DefaultName="Intel/Linux"
  530.     ;;
  531. esac
  532.  
  533. if  [ -z "$ReadDefaultNum" ] ; then
  534.   echo ""
  535.   echo "WARNING: The chosen configuration will not run on your current platform ($OSname/$OSrelease)."
  536.   if yesno "Continue installation? [n] " 1 ; then
  537.     :
  538.   else
  539.     exit 1
  540.   fi
  541. fi
  542.  
  543.  
  544. #
  545. # If multiple confurations, get the default configuration
  546. #
  547.  
  548. if [ -z "$SingleConfig" ] ; then
  549.   if [ "$ReadDefaultNum" ] ; then
  550.     if yesno "Install default configuration, Acrobat Reader ${Version} for $DefaultName? [y] " 0 ; then
  551.       DefaultConfig="$ReadDefaultNum"
  552.     fi
  553.   fi
  554. fi
  555.  
  556.  
  557. #
  558. # If a single configuration available the loop will be executed once
  559. # otherwise it will ask for each configuration to install
  560. #
  561.  
  562. while [ "$NumConfigs" -gt 1 ] ; do
  563.  
  564.   #
  565.   # If multiple configuration ask for which to install
  566.   #
  567.  
  568.   if [ "$SingleConfig" ] ; then
  569.  
  570.     ConfigNum=1
  571.  
  572.   elif [ "$DefaultConfig" ] ; then
  573.  
  574.     ConfigNum="$DefaultConfig"
  575.  
  576.   else
  577.  
  578.     #
  579.     # Display multiple configurations
  580.     #
  581.  
  582.     echo " "
  583.     echo "The following configurations are available for installation:"
  584.     echo " "
  585.  
  586.     if [ "$AcroSparcSolarisNum" ] ; then
  587.       echo "  ${AcroSparcSolarisNum}. Acrobat ${Version} for SPARC/Solaris 2.x"
  588.     fi
  589.     if [ "$AcroHppaHpuxNum" ] ; then
  590.       echo "  ${AcroHppaHpuxNum}. Acrobat ${Version} for HP-UX"
  591.     fi
  592.     if [ "$AcroRS6000AIXNum" ] ; then
  593.       echo "  ${AcroRS6000AIXNum}. Acrobat ${Version} for AIX"
  594.     fi
  595.     if [ "$AcroIntelLinuxNum" ] ; then
  596.       echo "  ${AcroIntelLinuxNum}. Acrobat ${Version} for Intel/Linux"
  597.     fi
  598.     if [ "$ReadSparcSolarisNum" ] ; then
  599.         echo "  ${ReadSparcSolarisNum}. Acrobat Reader ${Version} for SPARC/Solaris 2.x"
  600.     fi
  601.     if [ "$ReadHppaHpuxNum" ] ; then
  602.         echo "  ${ReadHppaHpuxNum}. Acrobat Reader ${Version} for HP-UX"
  603.     fi
  604.     if [ "$ReadRS6000AIXNum" ] ; then
  605.       echo "  ${ReadRS6000AIXNum}. Acrobat Reader ${Version} for AIX"
  606.     fi
  607.     if [ "$ReadIntelLinuxNum" ] ; then
  608.       echo "  ${ReadIntelLinuxNum}. Acrobat Reader ${Version} for Intel/Linux"
  609.     fi
  610.     if [ "$ExitNum" ] ; then
  611.         echo "  ${ExitNum}. Exit Acrobat installation"
  612.     fi
  613.  
  614.     echo " "
  615.     $echonl "Enter the configuration number to install: "
  616.     read ConfigNum
  617.  
  618.   fi
  619.  
  620.  
  621.   #
  622.   # Install the configuration
  623.   #
  624.  
  625.   if [ -z "$ConfigNum" ] ; then
  626.  
  627.     echo " "
  628.     echo "ERROR: Invalid response ... try again"
  629.     continue
  630.   elif [ "$ConfigNum" = "$ReadSparcSolarisNum" ] ; then
  631.  
  632.     InstallReader sparcsolaris "$ReadSparcSolarisTar" \
  633.       "$SearchSparcSolarisTar" "$CustomSparcSolarisTar"
  634.     ReadSparcSolarisNum=""
  635.   elif [ "$ConfigNum" = "$ReadHppaHpuxNum" ] ; then
  636.  
  637.     InstallReader hppahpux "$ReadHppaHpuxTar" \
  638.       "$SearchHppaHpuxTar" "$CustomHppaHpuxTar"
  639.     ReadHppaHpuxNum=""
  640.   elif [ "$ConfigNum" = "$ReadRS6000AIXNum" ] ; then
  641.  
  642.     InstallReader rs6000aix "$ReadRS6000AIXTar" \
  643.       "$SearchRS6000AIXTar" "$CustomRS6000AIXTar"
  644.     ReadRS6000AIXNum=""
  645.  
  646.   elif [ "$ConfigNum" = "$ReadIntelLinuxNum" ] ; then
  647.  
  648.     InstallReader intellinux "$ReadIntelLinuxTar" \
  649.       "$SearchIntelLinuxTar" "$CustomIntelLinuxTar"
  650.     ReadIntelLinuxNum=""
  651.  
  652.   elif [ "$ConfigNum" = "$ExitNum" ] ; then
  653.  
  654.     break
  655.  
  656.   else
  657.  
  658.     echo " "
  659.     echo "ERROR: Invalid response ... try again"
  660.     continue
  661.  
  662.   fi
  663.  
  664.   if [ "$DefaultConfig" ] ; then
  665.     break;
  666.   fi
  667.  
  668.   if [ -z "$MultipleInstall" ] ; then
  669.     break;
  670.   fi
  671.  
  672.   NumConfigs=`expr $NumConfigs - 1`
  673.  
  674. done
  675.  
  676. echo " "
  677. exit 0
  678.